<?php
    $pathToRoot = "";
    
    // ------------------------------------------------
    require_once "Controller/LoginController.php";
    require_once "Controller/RegisterController.php";

    require_once "View/LoginView.php";
    require_once 'View/LoginActionView.php';
    require_once "View/RegisterView.php";

    require_once "Model/LoginHandler.php";
    require_once "Model/RegisterHandler.php";

    require_once "Common/Database.php";
    require_once "Common/DBConfig.php";    
    require_once "Common/User.php";
    require_once "Common/Validate.php";
    // ------------------------------------------------
    
    session_start();

    $title = "Login";

    // Skapar nya nödvändiga objekt.
    $dbConfig = new DBConfig();
    $database = new Database($dbConfig);
    $validate =  new Validate();
    
    $loginHandler = new LoginHandler($database);
    $registerHandler = new RegisterHandler($database, $validate);
    
    $loginView = new LoginView();
    $registerView = new RegisterView();

    $loginController = new loginController();
    $registerController = new RegisterController($validate);

    // Kör igenom hela login senariot.
    $login = $loginController->DoLogInControll($loginHandler, $loginView); 
    $database->CloseConnection();
?>
<?php include("Common/Head.php");?>
        
<body>   
    <div id="wrapper">    
         <?php include("Common/Menu.php");?>        
        <div id="container">
            <div id="content">
                 <?php echo $login; ?>
            </div>           
        </div>        
        <?php include("Common/Footer.php");?>